package lu.uni.adtool.domains.predefined;

import lu.uni.adtool.domains.Domain;

import lu.uni.adtool.domains.rings.Bool;

/**
 * A Domain defined on booleans.
 * 
 * @author Piot Kordy
 */
public class BoolOrAndStar implements Domain<Bool>
{
  //number 1
  static final long serialVersionUID = 168474778914366456L;
  /**
   * A default constructor.
   * 
   */
  public BoolOrAndStar()
  {
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#getDefaultValue()
   */
  public final Bool getDefaultValue(final boolean proponent)
  {
    if  (proponent){
      return new Bool(false);
    }
    else{
      return new Bool(false);
    }
  }
  /**
   * {@inheritDoc}
   * @see Domain#isValueModifiable(boolean)
   */
  public final boolean isValueModifiable(final boolean proponent)
  {
    return true;
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#getName()
   */
  public final String getName()
  {
    return "Satisfiability of the scenario";
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#getDescription()
   */
  public final String getDescription()
  {
    final String name = "Satisfiability&nbsp;of&nbsp;the&nbsp;scenario&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
      + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    final String vd = "{true,&nbsp;false}";
    final String[] operators = { "<i>x</i>&nbsp;&or;&nbsp;<i>y</i>",
                                "<i>x</i>&nbsp;&and;&nbsp;<i>y</i>",
                                "<i>x</i>&nbsp;&or;&nbsp;<i>y</i>",
                                "<i>x</i>&nbsp;&and;&nbsp;<i>y</i>",
                                "<i>x</i>&nbsp;&and;&nbsp;&not;<i>y</i>",
                                "<i>x</i>&nbsp;&and;&nbsp;&not;<i>y</i>",};
    return DescriptionGenerator.generateDescription(this, name, vd, operators);
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#op(Bool,Bool)
   */
  public final Bool op(final Bool a, final Bool b)
  {
    return Bool.or(a,b);
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#ap(Bool,Bool)
   */
  public final Bool ap(final Bool a, final Bool b)
  {
    return Bool.and(a,b);
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#oo(Bool,Bool)
   */
  public final Bool oo(final Bool a, final Bool b)
  {
    return Bool.or(a,b);
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#ao(Bool,Bool)
   */
  public final Bool ao(final Bool a, final Bool b)
  {
    return Bool.and(a,b);
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#cp(Bool,Bool)
   */
  public final Bool cp(final Bool a, final Bool b)
  {
    return Bool.and(a,Bool.not(b));
  }

  /**
   * {@inheritDoc}
   * 
   * @see Domain#co(Bool,Bool)
   */
  public final Bool co(final Bool a, final Bool b)
  {
    return Bool.and(a,Bool.not(b));
  }
}


